import os
from celery import Celery,platforms

from worker import config


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lazy_pig_bookkeeping.settings')

celery_app = Celery('lazy_pig_bookkeeping')

platforms.C_FORCE_ROOT = True   # 如果在liunx中是以root启动的,需要这一段

celery_app.config_from_object(config)
celery_app.autodiscover_tasks()




"""

需要安装 celery : 

pip install celery



启动celery: celery -A worker worker -l info 

守护进程启动celery : celery multi start w1 -A worker -l info --logfile=/var/log/lazy_pig_bookkeeping/celery.log
logfile: 日志的文件所在地
重启 : start 改成 restart
停止相对应得如此

"""
